﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ABMath.ModelFramework.Data;
using ABMath.ModelFramework.Visuals;

namespace ExtraControlLibrary.VisualControls
{
    public partial class ForecastControl : UserControl, IUpdateable
    {
        private ForecastVisual forecastVisual;

        public ForecastControl(ForecastVisual fv)
        {
            InitializeComponent();
            forecastVisual = fv;
            fv.AssociatedControl = this;
            DataHasChanged();
        }

        public void DataHasChanged()
        {
            if (forecastVisual.meansWithQuantiles != null)
            {
                List<TimeSeries> tsList = forecastVisual.meansWithQuantiles.ExtractList();
                mainTSPlot.AddSeries(tsList[0]);
                mainTSPlot.AddSeries(tsList[1]);
                mainTSPlot.AddSeries(tsList[2]);
                mainTSPlot.AddSeries(tsList[3]);
                mainTSPlot.AddSeries(tsList[4]);
                mainTSPlot.Refresh();
            }
        }
    }
}
